namespace Delphi.Mimir.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddFxRates : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "fin.eod_fx_rates",
                c => new
                    {
                        fxr_id = c.Int(nullable: false, identity: true),
                        fxr_cur_id = c.Int(nullable: false),
                        fxr_sym_1_id = c.Int(nullable: false),
                        fxr_sym_2_id = c.Int(nullable: false),
                        fxr_factor = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.fxr_id)
                .ForeignKey("fin.com_currencies", t => t.fxr_cur_id, cascadeDelete: true)
                .ForeignKey("fin.eod_symbols", t => t.fxr_sym_1_id)
                .ForeignKey("fin.eod_symbols", t => t.fxr_sym_2_id)
                .Index(t => t.fxr_cur_id)
                .Index(t => t.fxr_sym_1_id)
                .Index(t => t.fxr_sym_2_id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("fin.eod_fx_rates", "fxr_sym_2_id", "fin.eod_symbols");
            DropForeignKey("fin.eod_fx_rates", "fxr_sym_1_id", "fin.eod_symbols");
            DropForeignKey("fin.eod_fx_rates", "fxr_cur_id", "fin.com_currencies");
            DropIndex("fin.eod_fx_rates", new[] { "fxr_sym_2_id" });
            DropIndex("fin.eod_fx_rates", new[] { "fxr_sym_1_id" });
            DropIndex("fin.eod_fx_rates", new[] { "fxr_cur_id" });
            DropTable("fin.eod_fx_rates");
        }
    }
}
